import { reqcatelist } from '../../http/api'
let state = {
    list: [],
};
let getters = {
    list(state) {
        return state.list;
    }
};
let mutations = {
    changeList(state, list) {
        state.list = list;
    }
};
let actions = {
    getList({ commit }) {
        return new Promise( async(resolve,reject) => {
            let { data: res } = await reqcatelist({ istree: true });
            if (res.code == 200) {
                let arr = res.list ? res.list : []
                commit('changeList', arr);
                resolve();
            }
        })
    }
};
export default {
    state,
    actions,
    mutations,
    getters,
    namespaced: true
}